package route

import (
	"github.com/gin-gonic/gin"
	"github.com/vueadmin/app/admin/internal/handler/login"
	"github.com/vueadmin/app/admin/internal/middle"
	"github.com/vueadmin/app/admin/internal/svc"
)

type Login struct{}

func (p Login) RegisterRoute(route *gin.Engine, svcCtx *svc.ServiceContext) {
	r := route.Group(svcCtx.Config.Prefix)
	r.POST("/Login/login", func(c *gin.Context) { login.Login(c, svcCtx) })
	r.POST("/Login/verify", middle.NewBeforActionMiddleware(svcCtx).Handle(), func(c *gin.Context) { login.Captcha(c, svcCtx) })
	r.POST("/Base/aliOssCallBack", func(c *gin.Context) { login.AliOssCallBack(c, svcCtx) })
	r.POST("/Index/logout", func(c *gin.Context) { login.Logout(c, svcCtx) })
}
